package com.bezdelnick.forum.mail;

import com.bezdelnick.forum.domain.Answer;
import com.bezdelnick.forum.domain.Question;
import com.bezdelnick.forum.mail.type.AbstractMail;
import com.bezdelnick.forum.mail.type.NotificationAnswerMail;
import com.bezdelnick.forum.mail.type.NotificationQuestionMail;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by IntelliJ IDEA.
 * User: Bezdelnick
 * Date: 20.07.12
 * Time: 12:00
 * To change this template use File | Settings | File Templates.
 */
public class MailFactory {
    private static final Logger LOGGER = LoggerFactory.getLogger(MailFactory.class);

    public static AbstractMail buildMailFor(Class type) {
        if (type.equals(Question.class)) {
            LOGGER.info("Create new NotificationQuestionMail");
            return new NotificationQuestionMail();
        }
        if (type.equals(Answer.class)) {
            LOGGER.info("Create new NotificationAnswerMail");
            return new NotificationAnswerMail();
        }
        return null;
    }
}
